/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/database/SPCallLog.cpp,v 1.5 2003/11/21 12:39:24 itsme Exp $
 *
 *
 * this file handles the CryptoPhone calllog database
 *
 * this is not yet used.
 *
 */
#include "SPCallLog.h"

WCHAR *SPCallLog::DatabaseName()
{
    return L"splog.db";
}

SPCallLog::SPCallLog()
{
}

SPCallLog::~SPCallLog()
{
}

void SPCallLog::Open()
{
    if (!m_db.Open(DatabaseName()))
    {
        m_db.Create(DatabaseName());
        m_db.Open(DatabaseName());
    }
}

void SPCallLog::AddEntry(const SPCallLogEntry &entry)
{
    CeRecord rec(6);
    rec.AddString(DBSPCALLLOG_NAME_FIELD, entry.name);
    rec.AddString(DBSPCALLLOG_NUMBER_FIELD, entry.number);
    rec.AddTimestamp(DBSPCALLLOG_START_FIELD, &entry.startTime);
    rec.AddTimestamp(DBSPCALLLOG_END_FIELD, &entry.endTime);
    rec.AddUInt32(DBSPCALLLOG_CALLTYPE_FIELD, entry.callType);
    rec.AddString(DBSPCALLLOG_KEYSIGNATURE_FIELD, entry.keySignature);
    m_db.CommitRecord(rec);
}
